//- Copyright (C) 2023 Beijing Huaxia Chunsong Technology Co., Ltd. 
//- <https://www.chatopera.com>, Licensed under the Chunsong Public 
//- License, Version 1.0  (the "License"), https://docs.cskefu.com/licenses/v1.html
//- Unless required by applicable law or agreed to in writing, software
//- distributed under the License is distributed on an "AS IS" BASIS,
//- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//- See the License for the specific language governing permissions and
//- limitations under the License.
//- Copyright (C) 2018-Jun. 2023 Chatopera Inc, <https://www.chatopera.com>
//- Licensed under the Apache License, Version 2.0
//- http://www.apache.org/licenses/LICENSE-2.0
extends /apps/include/layout.pug
block content
    .layui-side.layui-bg-black
        .layui-side-scroll
            include /apps/service/include/left.pug
    .layui-body
        .layui-side-scroll
            .row
                .col-lg-12
                    h1.site-h1(style='border-top:1px solid #e6e6e6;') 访客留言 #{leaveMsgList.totalElements ? "（" + leaveMsgList.totalElements + "）" : "（0）"}
                    table.layui-table.overflow(lay-skin='line', style='table-layout: fixed; word-break: break-all;')
                        thead
                            tr.design-sortable-tr
                                th 渠道
                                th 名称
                                th 姓名
                                th 电话
                                th 邮件
                                th 地址
                                th QQ
                                th(width='20%') 内容
                                th 技能组
                                th(width='80px') 留言时间
                                th 操作
                        tbody
                            if leaveMsgList.content.size() > 0
                                for leaveMsg in leaveMsgList.content
                                    tr.tdHasContorllor.design-dropable-td
                                        td.first_td_head(title=leaveMsg.channel.snstype, valign="top")
                                            p
                                                a(href="javascript:void(0)")
                                                    if leaveMsg.channel.type == "webim"
                                                        | 网站
                                                    else if leaveMsg.channel.type == "phone"
                                                        | 电话
                                                    else if leaveMsg.channel.type == "skype"
                                                        | Skype
                                                    else
                                                        | 未知
                                        td(title= leaveMsg.channel.name, valign="top")
                                            p #{leaveMsg.channel.name}
                                        td(title= leaveMsg.name, valign="top")
                                            p #{leaveMsg.name}
                                        td(title= leaveMsg.mobile, valign="top")
                                            p #{leaveMsg.mobile}
                                        td(title= leaveMsg.email, valign="top")
                                            p #{leaveMsg.email}
                                        td(title= leaveMsg.address, valign="top")
                                            p #{leaveMsg.address}
                                        td(title= leaveMsg.qq, valign="top")
                                            p #{leaveMsg.qq}
                                        td(title= leaveMsg.content, valign="top")
                                            p #{leaveMsg.content}
                                        td(title= leaveMsg.skill, valign="top")
                                            p #{leaveMsg.skill}
                                        td(valign="top") #{pugHelper.formatDate('yyyy-MM-dd HH:mm:ss', leaveMsg.createtime)}
                                        td(valign="top")
                                            a(href="/service/leavemsg/delete.html?id=" + leaveMsg.id, data-toggle="tip", title="删除留言不可恢复,请确认是否删除留言？")
                                                i.layui-icon &#x1006;
                                                | 删除
                            else
                                tr
                                    td(colspan="8" style="height:400px;")
                                        .ukefu-empty(style="background: none")
                                            i.layui-icon &#xe63a;
                                            div(style="") 当前没有在线坐席

        .row(style='padding:5px;')
            .col-lg-12#page(style='text-align:center;')

    style.
        .overflow td p{
                display: -webkit-box;
                -webkit-box-orient: vertical;
                -webkit-line-clamp: 3;
                overflow: hidden;
            }

    script.
        layui.use(['laypage', 'layer'], function(){
                  var laypage = layui.laypage
                  ,layer = layui.layer;

                  laypage({
                        cont: 'page'
                        , pages: #{leaveMsgList ? leaveMsgList.totalPages : 0} //总页数
                        , curr: #{leaveMsgList ? leaveMsgList.number + 1 : 0}
                        ,groups: 5 //连续显示分页数
                        ,jump:function(data , first){
                            if(!first){
                                location.href = "/service/leavemsg/index.pug?p="+data.curr ;
                            }
                        }
                   });
                });

